//
//  ZMainNavigationController.m
//  OC-weibo
//
//  Created by zero on 17/3/19.
//  Copyright © 2017年 zero. All rights reserved.
//

#import "ZMainNavigationController.h"

@interface ZMainNavigationController ()

@end

@implementation ZMainNavigationController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark
#pragma mark - 重写push的方法
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated{
    
    NSInteger count = self.viewControllers.count;
    
    if (count > 0) {
        
        viewController.navigationItem.leftBarButtonItem = [UIBarButtonItem initWithTitle:@"返回" andImageName:@"navigationbar_back_withtext" andTarget:self andSel:@selector(back)];
        viewController.hidesBottomBarWhenPushed = YES;
        
        viewController.view.backgroundColor = [UIColor z_colorWithHex:0xf5f5f9];
    }
    
    [super pushViewController:viewController animated:animated];
}

#pragma mark
#pragma mark - back方法
- (void)back{
    
    [self popViewControllerAnimated:YES];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
